"""
绘制正弦余弦图
"""
import numpy as np
import matplotlib.pyplot as plt
import math

x = np.arange(0,2*np.pi,0.1) # 0.1为间隔
y1 = np.sin(x)
y2 = np.cos(x)

plt.plot(x,y1,linewidth=2, label="sin")
plt.plot(x,y2,ls=":",linewidth=4,c="orange",label="cos")
# 设置x、y轴范围
plt.xlim(0,7)
plt.ylim(-1.5,1.5)

# 设置x、y刻度
# plt.xticks([1,3,5,7],["a","b","c","d"])
# plt.yticks([-1,-0.7,-0.2,0,3,5,1])

# 设置x轴和y轴的名称
plt.xlabel("x")
plt.ylabel("y")

plt.title("sin and cos")
plt.legend(loc=2) # 想要显示图例，必须要有
plt.show()